<?php if (!defined('THINK_PATH')) exit(); /*a:2:{s:69:"/phpstudy/www/xxm.com/public/../project/app/admin/view/api/index.html";i:1555401359;s:75:"/phpstudy/www/xxm.com/public/../project/app/admin/view/layout_menu_all.html";i:1555401363;}*/ ?>
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
    <meta http-equiv="Cache-Control" content="max-age=2592000" />
    <title><?php echo config('website_title'); ?></title>
    <link href="__STATIC__/favicon.ico" rel="shortcut icon">
    <link href="__STATIC__/admin/css/base.css" rel="stylesheet">
    <link href="__STATIC__/admin/css/index.css" rel="stylesheet" />
    <link href="__STATIC__/admin/css/system.css" rel="stylesheet" />
    <script type="text/javascript" src="__STATIC__/common/jquery-1.8.3.min.js"></script>
    <script type="text/javascript" src="__STATIC__/common/jquery.validate.js"></script>
    <script type="text/javascript" src="__STATIC__/common/jquery.metadata.js"></script>
    <script type='text/javascript' src="__STATIC__/common/jquery.resizableColumns.js"></script>
    <script type="text/javascript" src="__STATIC__/common/plugins/layer/layer.min.js"></script>
    <script type="text/javascript" src="__STATIC__/admin/js/common.js?v=1.0"></script>
    <script type="text/javascript" src="__STATIC__/common/json2.js"></script>
    <script type="text/javascript">
        var json = JSON.parse('<?php echo \think\Config::get('json'); ?>');
        var upload_url = "<?php echo url('common/file'); ?>";
    </script>
</head>
<body>
    <div class="warp tree">
        <div class="head-content">
            <!-- 页面head -->
            <div class="head">
                <div class="user-logo" style="color: #fff;font-size: 30px;width:500px;font-family:Arial,Helvetica,sans-serif;"><?php echo config('website_title'); ?></div>
                <div class="user-info">
                    <p>
                        欢迎[<font color="red"><?php echo get_login_admin_role_name(); ?></font>]<a href="<?php echo Url('admin/admin_info'); ?>"><?php echo get_login_admin_user(); ?></a>的到来 |
                        <!--<a href="<?php echo Url('system/clear_cache_all'); ?>">最新消息（<font color="red">10</font>）</a> |-->
                        <a href="<?php echo Url('system/clear_cache_all'); ?>">清除缓存</a> |
                        <a href="<?php echo Url('login/logout'); ?>">退出</a>
                    </p>
                    <p><span>版本：1.0.0</span><span>最后登录IP：<?php echo get_client_ip(); ?></span></p>
                </div>
            </div>

            <!-- 一级菜单 -->
            <div class="nav-box">
                <ul class="nav" id="_menu_one">
                    <?php if(is_array(\think\Config::get('menu.menu')[1]) || \think\Config::get('menu.menu')[1] instanceof \think\Collection || \think\Config::get('menu.menu')[1] instanceof \think\Paginator): if( count(\think\Config::get('menu.menu')[1])==0 ) : echo "" ;else: foreach(\think\Config::get('menu.menu')[1] as $key=>$menu_one): if(($menu_one['menu_id'] == \think\Config::get('menu.current')[1])): ?>
                            <li class="cur"><a href="<?php echo Url($menu_one['action']); ?>"><span><?php echo $menu_one['name']; ?></span></a></li>
                        <?php else: ?>
                            <li><a href="<?php echo Url($menu_one['action']); ?>"><span><?php echo $menu_one['name']; ?></span></a></li>
                        <?php endif; endforeach; endif; else: echo "" ;endif; ?>
                </ul>
            </div>

            <!-- 内容 -->
            <div class="container">
                <!-- 二级菜单 -->
                <div class="side fl mt10">
                    <!-- 二级菜单 -->
                    <div class="scroll-bar-box">
                        <div class="view-port">
                            <div id="overviewTreeGroup" class="overview">
                                <ul id="_menu_two">
                                    <?php if(is_array(\think\Config::get('menu.menu')[2]) || \think\Config::get('menu.menu')[2] instanceof \think\Collection || \think\Config::get('menu.menu')[2] instanceof \think\Paginator): if( count(\think\Config::get('menu.menu')[2])==0 ) : echo "" ;else: foreach(\think\Config::get('menu.menu')[2] as $key=>$menu_two): if(($menu_two['menu_id'] == \think\Config::get('menu.current')[2])): ?>
                                            <li class="cur"><a href="<?php echo Url($menu_two['action']); ?>"><span><?php echo $menu_two['name']; ?></span></a></li>
                                        <?php else: ?>
                                            <li><a href="<?php echo Url($menu_two['action']); ?>"><span><?php echo $menu_two['name']; ?></span></a></li>
                                        <?php endif; endforeach; endif; else: echo "" ;endif; ?>
                                </ul>
                            </div>
                        </div>
                    </div>
                </div>

                <!-- 页面主体内容 -->
                <div class="cont mt10">
                    <!-- 收缩条 -->
                    <div id="content_hide" style="position: relative; left:-10px; top: 285px;" ret="1">
                        <div class="effect-btn">
                            <img src="__STATIC__/admin/css/img/btn_icon02.gif" class="left">
                        </div>
                    </div>

                    <!-- 搜索框及工具条 -->
                    <div class="crumbs-box">
                        <div class="crumbs">
                            <!-- 导航条 -->
                            <div class="fl" id="_mini_nav">
                                <a class='blue' href='<?php echo Url(\think\Config::get('menu')["menu"][1][\think\Config::get('menu')["current"][1]]["action"]); ?>'><?php echo \think\Config::get('menu')["menu"][1][\think\Config::get('menu')["current"][1]]["name"]; ?></a>&nbsp;>&nbsp;
                                <a class='blue' href='<?php echo Url(\think\Config::get('menu')["menu"][2][\think\Config::get('menu')["current"][2]]["action"]); ?>'><?php echo \think\Config::get('menu')["menu"][2][\think\Config::get('menu')["current"][2]]["name"]; ?></a>&nbsp;>&nbsp;
                                <a class='blue' href='<?php echo Url(\think\Config::get('menu')["menu"][3][\think\Config::get('menu')["current"][3]]["action"]); ?>'><?php echo \think\Config::get('menu')["menu"][3][\think\Config::get('menu')["current"][3]]["name"]; ?></a>
                            </div>

                            <!-- 返回 -->
                            <span><a class="return" href="javascript:history.go(-1);">返回上一页</a></span>
                        </div>
                    </div>

                    <!-- 编辑区域 -->
                    <div class="lists">
                        <!-- 三级菜单 -->
                        <div class="lists-tab">
                            <strong>
                                <!-- 设置第四级菜单 -->
                                <ul id="_menu_three">
                                    <!-- 设置第四级菜单 -->
                                    <?php if(is_array(\think\Config::get('menu.menu')[3]) || \think\Config::get('menu.menu')[3] instanceof \think\Collection || \think\Config::get('menu.menu')[3] instanceof \think\Paginator): if( count(\think\Config::get('menu.menu')[3])==0 ) : echo "" ;else: foreach(\think\Config::get('menu.menu')[3] as $key=>$menu_three): if(($menu_three['menu_id'] == \think\Config::get('menu.current')[3])): ?>
                                            <li class="current"><a href="<?php echo Url($menu_three['action']); ?>"><?php echo $menu_three['name']; ?></a></li>
                                        <?php else: ?>
                                            <li><a href="<?php echo Url($menu_three['action']); ?>"><?php echo $menu_three['name']; ?></a></li>
                                        <?php endif; endforeach; endif; else: echo "" ;endif; ?>
                                </ul>
                            </strong>
                        </div>

                        <!-- Layout加载内容-->
                        <!DOCTYPE>
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
    <meta http-equiv="X-UA-Compatible" content="IE=EmulateIE7" />
    <title>后台管理系统</title>
    <!--<link href="/Public/company/img/favicon.ico" rel="shortcut icon">-->
    <link href="/static/admin/css/base.css" rel="stylesheet">
    <link href="/static/admin/css/index.css" rel="stylesheet" />
    <link href="/static/admin/css/system.css" rel="stylesheet" />
    <script type="text/javascript" src="/static/admin/js/jquery-1.8.3.min.js"></script>
</head>
<body>
<!-- 编辑区域 -->
<div class="lists">
    <!--用户列表-->
    <div class="lists-tab-cont">
        <div style="border-bottom:1px solid #ddd;">
            <table style="width: 100%;" cellpadding="0" cellspacing="0" border="0">
                <?php if(is_array($api_list) || $api_list instanceof \think\Collection || $api_list instanceof \think\Paginator): if( count($api_list)==0 ) : echo "" ;else: foreach($api_list as $group=>$info): ?>
                    <tr><td style="font-weight: bold;"><?php echo $group; ?></td></tr>
                    <tr>
                        <td style="width: 100%;" id="api">
                            <ul style="width: 100%;">
                                <?php if(is_array($info) || $info instanceof \think\Collection || $info instanceof \think\Paginator): if( count($info)==0 ) : echo "" ;else: foreach($info as $action=>$item): ?>
                                    <li style="width: 15%;margin-right: 10px;float: left;"><a style="cursor: pointer;padding: 5px;" href="javascript:void(0);" data-url="<?php echo $item['api_url']; ?>" data-controller="<?php echo $item['api_controller']; ?>" data-action="<?php echo $item['api_action']; ?>"><?php echo $item['api_name']; ?></a></li>
                                <?php endforeach; endif; else: echo "" ;endif; ?>
                            </ul>
                        </td>
                    </tr>
                <?php endforeach; endif; else: echo "" ;endif; ?>
            </table>
        </div>

        <div style="border-top:1px solid #ddd;border-bottom:1px solid #ddd;margin-top: 20px;">
            <table class="edit-table" cellpadding="0" cellspacing="0" border="0">
                <tr>
                    <td style="width: 30%;border-right:2px solid #ddd;background-color: #E2E2E2;font-size: 12px;font-weight: bold;">参数设置</td>
                    <td style="width: 70%;background-color: #E2E2E2;font-size: 12px;font-weight: bold;">返回相关结果</td>
                </tr>
                <tr>
                    <td style="font-size: 12px;width: 30%;border-right:1px solid #ddd;padding: 0px;vertical-align: top;">
                        <form method="post" id="form_call" action="<?php echo Url('api_call'); ?>">
                            <input type="hidden" name="api_url" value=""/>
                            <input type="hidden" name="api_controller" value=""/>
                            <input type="hidden" name="api_action" value=""/>
                            <table class="info-table" cellpadding="0" cellspacing="0" border="0">
                                <thead>
                                    <tr>
                                        <td colspan="2" style="width: 40%;border-left:1px solid #ddd;border-bottom:1px solid #ddd;text-align: center;">名称</td>
                                        <td style="width: 60%;border-left:1px solid #ddd;border-bottom:1px solid #ddd;text-align: center;">值</td>
                                    </tr>
                                </thead>
                                <tbody>
                                    <tr class="token">
                                        <td rowspan="4" style="width: 10%;border:1px solid #ddd;">Token</td>
                                        <td style="width: 30%;border:1px solid #ddd;">用户ID：</td>
                                        <td style="width: 60%;border:1px solid #ddd;padding: 0px;">
                                            <input name="_u" value="" style="border:0px;width: 100%;height: 100%;" type="text" placeholder="必填项！" />
                                        </td>
                                    </tr>
                                    <tr class="token">
                                        <td style="width: 30%;border:1px solid #ddd;">设备ID：</td>
                                        <td style="width: 60%;border:1px solid #ddd;padding: 0px;">
                                            <input name="_d" style="border:0px;width: 100%;height: 100%;" type="text" value="27752b56f6650a33fdd64cf535720b2c" placeholder="非必填项！" />
                                        </td>
                                    </tr>
                                    <tr class="token">
                                        <td style="width: 30%;border:1px solid #ddd;">系统ID：</td>
                                        <td style="width: 60%;border:1px solid #ddd;padding: 0px;">
                                            <select name="_o" style="border:0px;width: 100%;height: 100%;">
                                                <option value="1" selected>安卓</option>
                                                <option value="2">IOS</option>
                                            </select>
                                        </td>
                                    </tr>
                                    <tr class="token">
                                        <td style="width: 30%;border:1px solid #ddd;">版本号：</td>
                                        <td style="width: 60%;border:1px solid #ddd;padding: 0px;">
                                            <input name="_v" style="border:0px;width: 100%;height: 100%;" type="text" value="1.0.1.10" placeholder="非必填项！" />
                                        </td>
                                    </tr>
                                    <tr id="submit_tr">
                                        <td colspan="3" style="text-align: center;">
                                            <input type="submit" class="but_blue" style="width: 90%;" value="提交">
                                        </td>
                                    </tr>
                                </tbody>
                            </table>
                        </form>
                    </td>
                    <td style="font-size: 12px;width: 70%;vertical-align: top;">
                        <table class="info-table" cellpadding="0" cellspacing="0" border="0">
                            <thead>
                                <tr>
                                    <td style="width: 20%;border-left:1px solid #ddd;border-bottom:1px solid #ddd;text-align: center;">名称</td>
                                    <td style="width: 80%;border-left:1px solid #ddd;border-bottom:1px solid #ddd;text-align: center;">值</td>
                                </tr>
                            </thead>
                            <tbody>
                                <tr>
                                    <td style="width: 20%;border:1px solid #ddd;vertical-align: top;">接口请求地址：</td>
                                    <td style="width: 80%;border:1px solid #ddd;padding: 0px;color:red;font-weight: bold;" id="url"></td>
                                </tr>
                                <tr style="height: 100px;">
                                    <td style="width: 20%;border:1px solid #ddd;vertical-align: top;">请求加密参数：</td>
                                    <td style="width: 80%;border:1px solid #ddd;padding: 0px;">
                                        <textarea style="width: 100%;height: 100%;border:0px;" id="request"></textarea>
                                    </td>
                                </tr>
                                <tr style="height: 100px;">
                                    <td style="width: 20%;border:1px solid #ddd;vertical-align: top;">请求解密参数：</td>
                                    <td style="width: 80%;border:1px solid #ddd;padding: 0px;">
                                        <pre style="line-height: 18px;padding: 0px;"  id="parameter"></pre>
                                    </td>
                                </tr>
                                <tr style="height: 100px;">
                                    <td style="width: 20%;border:1px solid #ddd;vertical-align: top;">请求返回参数：</td>
                                    <td style="width: 80%;border:1px solid #ddd;padding: 0px;">
                                        <textarea style="width: 100%;height: 100%;border:0px;"  id="response"></textarea>
                                    </td>
                                </tr>
                                <tr style="height: 400px;">
                                    <td style="width: 20%;border-left:1px solid #ddd;border-right:1px solid #ddd;vertical-align: top;">请求返回结果：</td>
                                    <td style="width: 80%;border-right:1px solid #ddd;padding: 0px;vertical-align: top;">
                                        <pre style="line-height: 18px;padding: 0px;"  id="result"></pre>
                                    </td>
                                </tr>
                            </tbody>
                        </table>
                    </td>
                </tr>
            </table>
        </div>

        <div style="border:0px;height: 40px;"></div>
    </div>
</div>

<!-- JS处理 -->
<script language="javascript">
    $(function(){
        //初期化
        var api_param = <?php echo $api_param; ?>;

        //参数模板
        var param_tpl = {
            getTemplate : function(info){
                return '<tr class="param_tr">\
                            <td colspan="2" style="width: 40%;border:1px solid #ddd;white-space: normal;">' + info.name + '[' + info.code + ']</td>\
                            <td style="width: 60%;border:1px solid #ddd;padding: 0px;">\
                                <input name="' + info.code + '" style="border:0px;width: 100%;height: 100%;" type="text" value="" placeholder="请输入参数！" />\
                            </td>\
                        </tr>';
            }
        }

        //选中API
        $("#api a").click(function(){
            //初期化
            var controller = $(this).attr("data-controller");
            var action = $(this).attr("data-action");

            //判断是否为取得token
            if((controller == "start" && action == "index") || (controller == "user" && action == "login")){
                $("tr.token").hide();
            }else{
                $("tr.token").show();
            }

            //设置接口ID
            $("input[name='api_url']").val($(this).attr("data-url"));
            $("input[name='api_controller']").val($(this).attr("data-controller"));
            $("input[name='api_action']").val($(this).attr("data-action"));

            //设置接口ID
            $("#request").val("");
            $("#parameter").text("");
            $("#token").text("");
            $("#response").val("");
            $("#result").text("");
            $("#url").text($(this).attr("data-url"));

            //设置选中接口
            $("#api a").css("color","#0086C8");
            $(this).css("color","red");

            //移除参数
            $("tr.param_tr").remove();

            //创建动态参数数
            var item = $(this).attr("data-controller") + "/" + $(this).attr("data-action");
            for(var x in api_param[item]){
                $("#submit_tr").before(param_tpl.getTemplate({
                    name : api_param[item][x].name,
                    code : api_param[item][x].code
                }));
            }
        });

        //请求API
        $("#form_call").submit(function(){
            //初期化
            var api_url = $("input[name='api_url']").val();
            var api_controller = $("input[name='api_controller']").val();
            var api_action = $("input[name='api_action']").val();

            //判断参数是否存在
            if($.trim(api_url) == "" || $.trim(api_controller) == "" || $.trim(api_action) == ""){
                alert("请选中接口名称！");
                return false;
            }

            //ajax信息
            $.post($(this).attr('action'),$(this).serializeArray(),function(data){
                if(data.status == "OK"){
                    $("#request").val(data.request);
                    $("#parameter").text(data.parameter);
                    $("#token").text(data.token);
                    $("#response").val(data.response);
                    $("#result").text(data.result);
                }else{
                    $("#request").val(data.request);
                    $("#parameter").text(data.parameter);
                    $("#token").text(data.token);
                    $("#response").val(data.response);
                    $("#result").text(data.result);
                    alert(data.info);
                }
            },"json");

            //放回值
            return false;
        });
    });
</script>

</body>
</html>
                    </div>
                </div>
            </div>
        </div>
    </div>
    <div class="footer_gp">
        <p>厦门酷融信息科技有限公司版权所有 © Copyright 2014-2017 	闽ICP备18006609号-1</p>
    </div>
</body>
<!-- JS处理 -->
<script language="javascript">
    $(function(){
        //修改列表宽度
        $("div.lists-table table.pointer").width("<?php echo get_screen(); ?>");

        //二级菜单显示异常操作
        $('#content_hide').click(function(){
            //判断二级菜单是否显示
            if($(this).attr("ret") == 1){
                $(this).attr("ret","2");
                $("div.container .side").hide();
                $("div.container .cont").css("width","98.7%");
                $(this).find("img").attr("src","__STATIC__/admin/css/img/btn_icon01.gif");
            }else{
                $(this).attr("ret","1");
                $("div.container .side").show();
                $("div.container .cont").css("width","85.6%");
                $(this).find("img").attr("src","__STATIC__/admin/css/img/btn_icon02.gif");
            }
        });

        //修改列表宽度
        $("div.lists-table table").resizableColumns(function(){});

        //数据检查
        $.metadata.setType('attr', 'validate');
        $('form').validate();

        //重写alert
        window.alert = layer.alert;
    });
</script>
</html>